#!/usr/bin/env ruby
# SPDX-License-Identifier: MulanPSL-2.0+
# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
# frozen_string_literal: true

require_relative '../defconfig.rb'

docker_skip_rebuild "logging-es:7.6.2"

BASE_IMAGE_DICT = {
  'aarch64' => 'gagara/elasticsearch-oss-arm64:7.6.2',
  'x86_64' => 'elasticsearch:7.6.2'
}.freeze

BASE_IMAGE = BASE_IMAGE_DICT[%x(arch).chomp]

available_memory = get_available_memory

system "docker build -t logging-es:7.6.2 --build-arg BASE_IMAGE=#{BASE_IMAGE} --build-arg MEMORY=#{available_memory} ."
